#include<iostream>
#include<string>
using namespace std;


int kill(string s){
    for(int i=0;i<s.length()-1;i++){
        if(s[i]>s[i+1])return i;
    }
    return -1;
}

int main(){
    string s;
    cin>>s;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int to_kill=kill(s);
        if(to_kill==-1)s.erase(s.end());
        else s.erase(to_kill,1);
    }
    cout<<s;
}